<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\Url;
?>
<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>
<div style="margin: 20px">
<h4>图片库</h4>
</div>
     <blockquote>
         图片
     </blockquote>
     <div class="row"> 
     <?php 
     foreach ($album as $key => $val) {
     	 echo "<div class=\"col s2\" style=\"height:150px\">";  	    	  
     	// $path = "/demo/backend/web/images/";
    	 $options = ['class'=>'materialboxed','style' => ['height' => '100px','width'=>'inherit'],'src'=>$val->url,];
                 $options1 = ['class'=>'center-align','onclick'=>'imgDel(this)','img-url'=>$val->url];	  
   	  echo Html::tag('img','',$options);
                echo    Html::tag('a','删除',$options1);
   	echo "</div>";
     }
     // $path = "/demo/backend/web/images/";
     // $options = ['style' => ['width' => '200px'],'class'=>'materialboxed','src'=>$path.'yanye.png'];
     // echo Html::tag('img','',$options);
      ?>
</div>

</div>
     	
  
      


<script type="text/javascript">

 function imgDel(obj) {  

        //利用对话框返回的值 （true 或者 false）  
        if (confirm("你确定删除吗？")) {  
            var url = $(obj).attr("img-url");
           var fm = "img"; 
            $.post("<?=Url::to(['admin/del'])?>",{url:url,fm:fm},function(result){
               window.location.reload();});
            
        }  
        else {  
           
        }  
  
    }
</script>
</body>
</html>

